package cn.com.lyj6851.auth;

import javax.sql.DataSource;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Primary;


@SpringBootApplication
//@SpringCloudApplication // @SpringBootApplication、@EnableDiscoveryClient、@EnableCircuitBreaker
@ComponentScan(basePackages = {"cn.com.lyj6851.common", "cn.com.lyj6851.auth"})
public class AuthServerApplication {
	public static void main(String[] args) {
        SpringApplication.run(AuthServerApplication.class, args);
    }
	
	/**
     * springboot默认读取spring.datasource，若要读取自己的需要改变datasource路径
     * @return
     */
    @Bean
    @Primary//增加注入优先级
    @ConfigurationProperties(prefix = "spring.datasource.hikari")
    public DataSource primaryDataSource() {
        return DataSourceBuilder.create().build();
    }
}
